home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
8_5.lha
/
8_5
/
fwrite.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-08
|
714b
|
30 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
/ write out num objects of the given
/ size from the named buffer
nt fwrite(void *vbuf, unsigned int size,
unsigned int num, FILE *f)
char *buf = (char*)vbuf;
if (f->mode != input)
{
// read in num * size bytes
for (unsigned int n = num; n-- > 0; )
for (unsigned int s = size; s-- > 0; )
if (!f->out->put(*buf++))
// The end of the output
// partway through an object.
// Return the number of complete
// objects written so far.
return num - n;
// Return the number of
// complete objects written
return num - n;
}
return 0;